package com.onpositive.gamemaker.visualizer.swt;

import com.onpositive.gamemaker.core.GraphicDevice;


public class GameObjectSprite extends BasicSprite
{
	
	/**
	 * Image painting x offset
	 * Default: 0
	 */
	protected int xoffset = 0;
	/**
	 * Image painting y offset. We can need this offset, than painting some objects, 
	 * which is contained in one cell, but should be painted on several cells.
	 * E.g. high tree or tower can be painted not only over (x,y)th cell, but over (x,y-1)th cell too
	 * Default: 0
	 */
	protected int yoffset = 0;

	public GameObjectSprite(String id, String imageId, int xoffset, int yoffset)
	{
		super(id, imageId);
		this.xoffset = xoffset;
		this.yoffset = yoffset;
	}

	public GameObjectSprite(String id, String imageId)
	{
		super(id, imageId);
	}

	public GameObjectSprite(String id)
	{
		super(id);
	}
	
	@Override
	public void paint(int x, int y, int width, int height, GraphicDevice context)
	{
		context.drawImage(imageId,x + xoffset,y + yoffset,width,height);
		
	}

}
